<!DOCTYPE html>
<html lang="zh-CN">
	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
		<title>系统用户-新增</title>
		<link rel="icon" href="assets/img/lcxm.ico" type="image/ico">
		<script type="text/javascript" src="../../commonFragment/header.js"></script>
		<script type="text/javascript" src="../../commonFragment/nojs.header.js"></script>
		<script>
			$nojs.after(function(context){
			    console.info("i am after");
			});
			$nojs.before(function(context){
			    this.test.enable=false;    //禁用test模块
			    console.info("i am before");
			});
			var roleMenuTreeSetting= {
				check: {
					enable: true,
					chkboxType: { "Y": "", "N": "s"}// "Y": "ps", "N": "ps" 
				},
				callback: {
					onClick: clickTree,
					onCheck: zTreeOnCheck
				},
				view: {
					addDiyDom:addDiyDom
				},
				data:{
					key: {
							isParent: "pnode"
						}
				}
			};
			//选择节点的时候 获取全部选择的节点
			function zTreeOnCheck(event, treeId, treeNode) {
				var treeObj = $.fn.zTree.getZTreeObj("tree");
				if(!treeNode) {//说明是在初始化后第一次调用
					treeObj.expandAll(true);
				}
			   var selectMenuIds = treeObj.getCheckedNodes().map(function(node){
				   return node.id;
			   }).join(",");
			   $("#menuIds").val(selectMenuIds);
			};
			
			function clickTree(event, treeId, node) {
				
			}
			function addDiyDom(treeId, node) {
				/* var aObj = $("#" + node.tId + "_a");
				var iconClass = node.icon;
				var icon = '<i class="'+iconClass+ '"></i>';
				aObj.append(icon); */
			}
		</script>
	</head>
	<body>
		<div class="container-fluid p-t-15">
			<div class="row">
				<div class="col-lg-12">
					<div class="card">
						<div class="card-body">
							<form class="form-horizontal validate" role="form vue-form" method="post" action="/system/role/save"
							 data-form-url="/system/role/detail">

								<div class="form-group hide">
									<label for="id" class="col-sm-2 control-label">隐藏的*</label>
									<div class="col-sm-6 ">
										<input type="text" id="id" name="id" :value="id" />
									</div>
									<div class="col-sm-4  help-inline form-control-static"></div>
								</div>
								<div class="form-group">
									<label for="name" class="col-sm-2 control-label">角色名*</label>
									<div class="col-sm-6 ">
										<input type="text" class="form-control" id="name" name="name" :value="name" data-rule-required="true"
										 placeholder="请输入角色名" autocomplete="off" />
									</div>
									<div class="col-sm-4  help-inline form-control-static"></div>
								</div>

								<div class="form-group">
									<label for="remark" class="col-sm-2 control-label">备注</label>
									<div class="col-sm-6 ">
										<input type="text" class="form-control" id="remark" name="remark" :value="remark" placeholder="请输入备注"
										 autocomplete="off" />
									</div>
									<div class="col-sm-4  help-inline form-control-static"></div>
								</div>
								<div class="form-group">
									<label for="parentId" class="col-sm-2 control-label">状态*</label>
									<div class="col-sm-6 ">
										<select class="form-control" id="enable" name="enable" :data-value="enable" :value="enable"
										 data-rule-required="true">
											<option value="">--请选择--</option>
											<option value="false">禁用</option>
											<option value="true">启用</option>
										</select>
									</div>
									<div class="col-sm-4  help-inline form-control-static"></div>
								</div>
								<div class="form-group">
									<label for="pid" class="col-sm-2 control-label">权限</label>
									<div class="col-sm-6 ">
										<input type="hidden" id="menuIds" name="menuIds" />
										<ul id="tree" class="ztree" style="width: 100%;" data-url="/system/role/roleMenus" 
											:data-url="'/system/role/roleMenus?id='+id"
											data-setting="roleMenuTreeSetting" data-after="zTreeOnCheck">
										</ul>
									</div>
									<div class="col-sm-4  help-inline form-control-static"></div>
								</div>

								<div class="form-group clearfix">
									<div class="col-sm-offset-3 col-sm-9">
										<button type="button" class="btn btn-primary action-ajax-form">
											<i class="glyphicon glyphicon-ok"></i> 提交
										</button>
										<button type="button" class="btn btn-info action-close-tab">
											<i class="glyphicon glyphicon-repeat"></i> 返回
										</button>
									</div>
								</div>
							</form>
						</div>
					</div>
				</div>
			</div>
		</div>
	</body>
</html>
